/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package com.xtd.util;

/**
 *
 * @author Lu Yuanbin
 */
public enum CommodityPropertyEnum {

    套系商品(1),
    零售商品(2),
    虚拟商品(3),
    材料商品(4),
    加工商品(5);
    private int code;

    private CommodityPropertyEnum(int i) {
        code = i;
    }

    /**
     * @return the code
     */
    public int getCode() {
        return code;
    }

    /**
     * @param code the code to set
     */
    public void setCode(int code) {
        this.code = code;
    }

    public static String getName(int code) {
        String name = null;
        for (CommodityPropertyEnum c : CommodityPropertyEnum.values()) {
            if (code == c.code) {
                name = c.toString();
                break;
            }
        }
        return name;
    }

    public static int getCode(String name) {
        int c = 0;
        for (CommodityPropertyEnum cce : CommodityPropertyEnum.values()) {
            if (name.equals(cce.toString())) {
                c = cce.getCode();
                break;
            }
        }
        return c;
    }

 
   
}
